package hello;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

@Component
public class HelloRedisImpl {
    @Autowired
    private StringRedisTemplate redisTemplate;

    public void hello(){
        //opsFor开头有很多方法，有分别对应redis数据类型的方法，
        // 比如opsForValue是针对字符串类型，opsForSet是针对set集合类型
        ValueOperations<String, String> operations = redisTemplate.opsForValue();
        operations.set("java2","haha");

    }


}
